package com.example.javawebdemo.dao;

import com.example.javawebdemo.models.User;
import java.sql.SQLException;


/*
装饰者模式 (Decorator) - DAO日志增强
 */


// UserDAOLoggingDecorator.java
public class UserDAOLoggingDecorator implements UserDAO {
    private UserDAO wrapped;

    public UserDAOLoggingDecorator(UserDAO dao) {
        this.wrapped = dao;
    }

    @Override
    public User findByUsername(String username) throws SQLException {
        return null;
    }

    @Override
    public boolean registerUser(User user) throws SQLException {
        System.out.println("Registering user: " + user.getUsername());
        return wrapped.registerUser(user);
    }
}
